package org.dromara.system.business.label.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.dromara.common.core.utils.BeanUtils;
import org.dromara.system.business.label.domain.LabelRelationManage;
import org.dromara.system.business.label.domain.dto.LabelRelationManageDTO;
import org.dromara.system.business.label.service.LabelRelationManageService;
import org.dromara.system.business.label.mapper.LabelRelationManageMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
* @author chs
* @description 针对表【label_relation_manage】的数据库操作Service实现
* @createDate 2025-02-11 09:44:38
*/
@Service
public class LabelRelationManageServiceImpl extends ServiceImpl<LabelRelationManageMapper, LabelRelationManage>
    implements LabelRelationManageService{

    /**
     * 新增单个标签关联
     * @param: labelRelationManage 标签关联参数
     * @author CHS
     * @date: 2025/2/11 10:09
     */
    @Override
    public Boolean labelRelationAdd(LabelRelationManageDTO labelRelationManage) {
        LabelRelationManage relation = BeanUtils.copy(labelRelationManage, LabelRelationManage.class);
        return this.save(relation);
    }

    /**
     * 新增多个标签关联
     * @param: labelRelationManage 标签关联参数
     * @author CHS
     * @date: 2025/2/11 10:09
     */
    @Override
    @Transactional
    public Boolean labelRelationsAdd(List<LabelRelationManageDTO> labelRelationManages) {
        List<LabelRelationManage> relationList = BeanUtils.copyList(labelRelationManages, LabelRelationManage.class);
        return this.saveBatch(relationList);
    }
}




